home *** CD-ROM | disk | FTP | other *** search
/ Elite College Girls 1 / Elite College Girls - Volume 1.iso / pc / shared.dir / 01955.ls < prev    next >
Encoding:
Text File  |  1996-02-02  |  8.4 KB  |  174 lines

  1. global gInterfaceSprite, gPictSprite, gZoomFactor, gZoomFactors, gZoomLevels, gZoomDirection, gSpriteHeight, gSpriteWidth, gSpriteHeightPercent, gSpriteWidthPercent, gDistance, gDistanceH, gDistanceV
  2.  
  3. on setDimensions
  4.   if the type of sprite gPictSprite > 0 then
  5.     set whichCast to the castNum of sprite gPictSprite
  6.     if the castType of cast whichCast = #bitmap then
  7.       set gSpriteHeight to the height of sprite gPictSprite * 1.0 / 2
  8.       set gSpriteWidth to the width of sprite gPictSprite * 1.0 / 2
  9.       set gSpriteHeightPercent to the height of sprite gPictSprite * 1.0 / the height of cast whichCast
  10.       set gSpriteWidthPercent to the width of sprite gPictSprite * 1.0 / the width of cast whichCast
  11.       set gDistanceH to gDistance * gSpriteHeightPercent
  12.       set gDistanceV to gDistance * gSpriteWidthPercent
  13.     end if
  14.   end if
  15.   set the cursor of sprite gInterfaceSprite to -1
  16. end
  17.  
  18. on checkImage userH, userV
  19.   if userV < the top of sprite gInterfaceSprite then
  20.     set PICThModifier to ((userH < 20) - (userH > 620)) * gDistanceH
  21.     set PICTvModifier to ((userV < 20) - (userV > (the top of sprite gInterfaceSprite - 20))) * gDistanceV
  22.     set newH to checkRange(the locH of sprite gPictSprite + PICThModifier, gSpriteWidth, 640 - gSpriteWidth)
  23.     set newV to checkRange(the locV of sprite gPictSprite + PICTvModifier, gSpriteHeight, the top of sprite gInterfaceSprite - gSpriteHeight)
  24.     set the locH of sprite gPictSprite to newH
  25.     set the locV of sprite gPictSprite to newV
  26.     updateStage()
  27.     set PICThModifier to PICThModifier / gDistanceH * 10
  28.     set PICTvModifier to PICTvModifier / gDistanceV * 10
  29.     set newCursor to "Cursor " & integer(PICThModifier) & "," & integer(PICTvModifier)
  30.     if the optionDown then
  31.       if newCursor = "Cursor 0,0" then
  32.         set newCursor to "Cursor 1,1"
  33.       end if
  34.     end if
  35.     set whichCast to the number of cast newCursor
  36.     if whichCast > 0 then
  37.       set whichMaskCast to the number of cast (newCursor & " Mask")
  38.       set the cursor of sprite 1 to [whichCast, whichMaskCast]
  39.       cursor([whichCast, whichMaskCast])
  40.     end if
  41.   end if
  42.   puppetSprite(gPictSprite, 1)
  43.   go(the frame)
  44. end
  45.  
  46. on checkImage1 userH, userV
  47.   if userV < the top of sprite gInterfaceSprite then
  48.     set spriteWidth to the width of sprite gPictSprite
  49.     set spriteHeight to the height of sprite gPictSprite
  50.     set PICThModifier to ((userH < 20) - (userH > 620)) * gDistanceH
  51.     set PICTvModifier to ((userV < 20) - (userV > (the top of sprite gInterfaceSprite - 20))) * gDistanceV
  52.     set newH to checkRange(the locH of sprite gPictSprite + PICThModifier, gSpriteWidth, 640 - gSpriteWidth)
  53.     set newV to checkRange(the locV of sprite gPictSprite + PICTvModifier, gSpriteHeight, the top of sprite gInterfaceSprite - gSpriteHeight)
  54.     set the locH of sprite gPictSprite to newH
  55.     set the locV of sprite gPictSprite to newV
  56.     updateStage()
  57.     set PICThModifier to PICThModifier / gDistanceH * 10
  58.     set PICTvModifier to PICTvModifier / gDistanceV * 10
  59.     set newCursor to "ArrowCursor " & integer(PICThModifier) & "," & integer(PICTvModifier)
  60.     set the cursor of sprite 1 to [the number of cast newCursor, the number of cast (newCursor & " Mask")]
  61.     cursor([the number of cast newCursor, the number of cast (newCursor & " Mask")])
  62.   end if
  63.   puppetSprite(gPictSprite, 1)
  64.   go(the frame - 1)
  65. end
  66.  
  67. on checkImage2 userH, userV
  68.   if userV < the top of sprite gInterfaceSprite then
  69.     set PICThModifier to ((userH < 20) - (userH > 620)) * gDistanceH
  70.     set PICTvModifier to ((userV < 20) - (userV > (the top of sprite gInterfaceSprite - 20))) * gDistanceV
  71.     set newH to checkRange(the locH of sprite gPictSprite + PICThModifier, gSpriteWidth, 640 - gSpriteWidth)
  72.     set newV to checkRange(the locV of sprite gPictSprite + PICTvModifier, gSpriteHeight, the top of sprite gInterfaceSprite - gSpriteHeight)
  73.     set oldH to the locH of sprite gPictSprite
  74.     set oldV to the locV of sprite gPictSprite
  75.     updateDart(gPictSprite, 0, oldH, oldV, newH, newV, 1.79999999999999982)
  76.     updateDart(gPictSprite, 0, oldH, oldV, newH, newV, 1.59999999999999987)
  77.     updateDart(gPictSprite, 0, oldH, oldV, newH, newV, 1.39999999999999991)
  78.     updateDart(gPictSprite, 0, oldH, oldV, newH, newV, 1.19999999999999996)
  79.     updateDart(gPictSprite, 0, oldH, oldV, newH, newV, 1.0)
  80.     set PICThModifier to PICThModifier / gDistanceH * 10
  81.     set PICTvModifier to PICTvModifier / gDistanceV * 10
  82.     set newCursor to "ArrowCursor " & integer(PICThModifier) & "," & integer(PICTvModifier)
  83.     set the cursor of sprite 1 to [the number of cast newCursor, the number of cast (newCursor & " Mask")]
  84.     cursor([the number of cast newCursor, the number of cast (newCursor & " Mask")])
  85.   end if
  86.   puppetSprite(gPictSprite, 1)
  87.   go(the frame - 1)
  88. end
  89.  
  90. on zoomSprite whichSprite, userClickLoc, centerH, centerV, zoomDirection
  91.   if the type of sprite whichSprite = 0 then
  92.     exit
  93.   end if
  94.   set gZoomDirection to zoomDirection
  95.   set tryZoomFactor to gZoomFactor + zoomDirection
  96.   if (tryZoomFactor < 1) or (tryZoomFactor > gZoomLevels) then
  97.     beep()
  98.     exit
  99.   end if
  100.   set gZoomFactor to tryZoomFactor
  101.   set whichZoomFactor to getAt(gZoomFactors, gZoomFactor)
  102.   set whichCast to the castNum of sprite gPictSprite
  103.   if the castType of cast whichCast = #bitmap then
  104.     set gSpriteHeightPercent to the height of sprite gPictSprite * 1.0 / the height of cast whichCast
  105.     set gSpriteWidthPercent to the width of sprite gPictSprite * 1.0 / the width of cast whichCast
  106.     set gSpriteHeight to the height of cast whichCast * whichZoomFactor * 1.0 / 2
  107.     set gSpriteWidth to the width of cast whichCast * whichZoomFactor * 1.0 / 2
  108.     set centerLoc to point(centerH, centerV)
  109.     set zoomLoc to centerLoc - userClickLoc
  110.     set newH to centerH + (getAt(zoomLoc, 1) * 1.0 / gSpriteWidthPercent * whichZoomFactor)
  111.     set newV to centerV + (getAt(zoomLoc, 2) * 1.0 / gSpriteHeightPercent * whichZoomFactor)
  112.     set newH to checkRange(newH, gSpriteWidth, 640 - gSpriteWidth)
  113.     set newV to checkRange(newV, gSpriteHeight, the top of sprite gInterfaceSprite - gSpriteHeight)
  114.     puppetSprite(whichSprite, 1)
  115.     spriteBox(whichSprite, newH - gSpriteWidth, newV - gSpriteHeight, newH + gSpriteWidth, newV + gSpriteHeight)
  116.   end if
  117.   go(the frame)
  118.   setDimensions()
  119.   checkImage(the mouseH, the mouseV)
  120. end
  121.  
  122. on zoomPICT whichSprite, userClickLoc, centerH, centerV
  123.   if the type of sprite whichSprite = 0 then
  124.     exit
  125.   end if
  126.   set the stretch of sprite whichSprite to not (the stretch of sprite whichSprite)
  127.   if the stretch of sprite whichSprite = 1 then
  128.     set magnificationFactor to 2
  129.     set whichCast to the castNum of sprite whichSprite
  130.     set newHeight to the height of cast whichCast / (magnificationFactor * 2)
  131.     set newWidth to the width of cast whichCast / (magnificationFactor * 2)
  132.     spriteBox(whichSprite, centerH - newWidth, centerV - newHeight, centerH + newWidth, centerV + newHeight)
  133.   else
  134.     set centerLoc to point(centerH, centerV)
  135.     set zoomLoc to stripPoint(centerLoc - userClickLoc)
  136.     set the locH of sprite whichSprite to centerH + value(item 1 of zoomLoc)
  137.     set the locV of sprite whichSprite to centerV + value(item 2 of zoomLoc)
  138.   end if
  139.   updateStage()
  140. end
  141.  
  142. on zoomPICTtoCenterHV whichSprite, userClickLoc, centerH, centerV
  143.   if the type of sprite whichSprite = 0 then
  144.     exit
  145.   end if
  146.   set the stretch of sprite whichSprite to not (the stretch of sprite whichSprite)
  147.   set magnificationFactor to 2
  148.   if the stretch of sprite whichSprite = 1 then
  149.     set whichCast to the castNum of sprite whichSprite
  150.     set newHeight to the height of cast whichCast / (magnificationFactor * 2)
  151.     set newWidth to the width of cast whichCast / (magnificationFactor * 2)
  152.     spriteBox(whichSprite, centerH - newWidth, centerV - newHeight, centerH + newWidth, centerV + newHeight)
  153.   else
  154.     set centerLoc to point(centerH, centerV)
  155.     set zoomLoc to stripPoint(userClickLoc - centerLoc)
  156.     set the locH of sprite whichSprite to centerH - (value(item 1 of zoomLoc) * magnificationFactor)
  157.     set the locV of sprite whichSprite to centerV - (value(item 2 of zoomLoc) * magnificationFactor)
  158.   end if
  159.   updateStage()
  160. end
  161.  
  162. on getMagnificationFactor whichSprite, heightOrWidth
  163.   set whichCast to the castNum of sprite whichSprite
  164.   if heightOrWidth = 0 then
  165.     set castHeight to the height of cast whichCast
  166.     set spriteHeight to the height of cast whichCast
  167.     return 1.0 * castHeight / spriteHeight
  168.   else
  169.     set castWidth to the width of cast whichCast
  170.     set spriteWidth to the width of cast whichCast
  171.     return 1.0 * castWidth / spriteWidth
  172.   end if
  173. end
  174.